package com.monochromebytes.mononet.test;

import org.newdawn.slick.Graphics;
import org.newdawn.slick.geom.Polygon;
import org.newdawn.slick.geom.Shape;
import org.newdawn.slick.geom.Vector2f;

public class World extends Body {

    private static final long serialVersionUID = -3520830007893078119L;
    
    public final static float minX = 0;
    public final static float maxX = 600;
    public final static float minY = 0;
    public final static float maxY = 600;

    private static World    instance;

    private World() {
        float[] points = {
            World.minX, World.minY,
            World.maxX, World.minY,
            World.maxX, World.maxY,
            World.minX, World.maxY
        };
        super.init(new Polygon(points),
                   //new Rectangle(World.minX, World.minY, World.maxX - World.minX, World.maxY - World.minY),
                   new Vector2f(0, 0),
                   0,
                   Float.MAX_VALUE);
    }

    public static World getInstance() {
        if (World.instance == null) {
            World.instance = new World();
        }
        return World.instance;
    }

    @Override
    public void render(Graphics g) {
        g.setAntiAlias(false);
        super.render(g);
    }
    
    @Override
    public void update(int delta) {
        // Nothing to update.
    }
    
    @Override
    public Shape calculateShape(Shape shape, float delta) {
        // Does not move.
        return shape;
    }
    
    @Override
    public void moveToLastShape() {
        // Not allowed.
    }
    
    @Override
    public void setAngularFrequency(float frequency) {
        // Not allowed.
    }
    
    @Override
    public void setVelocity(Vector2f velocity) {
        // Not allowed.
    }
    
    @Override
    public void setMass(float mass) {
        // Not allowed.
    }
    
    @Override
    public float getInertia() {
        return Float.MAX_VALUE;
    }
}
